import java.util.concurrent.TimeUnit;

public interface ConnectionPool<T> {
    /**
     * Blocking method.
     *
     * @return Captured resource.
     */
    T get() throws InterruptedException;

    /**
     * Non blocking method.
     *
     * @return Captured resource.
     */
    T tryGet();

    /**
     * Blocking with timeout method.
     *
     * @param time Duration time.
     * @param unit Time unit.
     * @return Captured resource.
     */
    T tryGet(long time, TimeUnit unit) throws InterruptedException;

    /**
     * Release captured resource.
     *
     * @param object Captured resource.
     */
    void release(T object);
}